//
//  AccountMainViewController.m
//  HYApp
//
//  Created by Jianbo Cai on 2020/9/18.
//  Copyright © 2020 Unidax. All rights reserved.
//

#import "AccountMainViewController.h"
#import "AccountTableViewController.h"

@interface AccountMainViewController ()

@end

@implementation AccountMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark - WMPageController
- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    AccountTableViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"AccountTableViewController"];
    vc.walletsEntity = self.walletsEntity;
    vc.index = index;
    switch (index) {
        case 0:
            vc.ethEntity = self.walletsEntity.hkAccount;
            break;
        case 1:
            vc.ethEntity = self.walletsEntity.usAccount;
            break;
        case 2:
            vc.ethEntity = self.walletsEntity.sgAccount;
            break;
        default:
            break;
    }
    return vc;
}

- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return 3;
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    return CGRectZero;
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    return CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - SafeAreaTopHeight);
}

- (void)pageController:(WMPageController *)pageController didEnterViewController:(nonnull __kindof UIViewController *)viewController withInfo:(nonnull NSDictionary *)info {
    NSString *string = [NSString stringWithFormat:@"%@Account", ((AccountTableViewController *)viewController).ethEntity.metadata.jurisdiction];
    self.title = JFMainLocalizedString(string);
}

@end
